import java.util.Scanner;

public class Practice06 {
    //实现一个简单的计算器。用户输入两个数字和一个操作符(如加法、减法、乘法或除法)，
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入两个数：");
        int num1 = sc.nextInt();
        int num2 = sc.nextInt();
        System.out.println("请输入运算符：");
        String dp = sc.next();
        isCount(num1,num2,dp);
    }
    public static int isCount(int num1, int num2, String dp){
        int  result = 0;
        boolean flag = true;
        switch (dp){
            case "+":
                result = num1 + num2;
                break;
            case "-":
                result = num1 - num2;
                break;
            case "*":
                result = num1 * num2;
                break;
            case "/":
                result = num1 / num2;
                break;
            case "%":
                result = num1 % num2;
                break;
            default:
                flag = false;
                System.out.println("无效运算符");
                break;
        }
        if (flag){
            System.out.println(result);
        }
        return result;
    }
}
